<template>
  <div>
    <!-- 面包屑导航区 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>用户管理</el-breadcrumb-item>
      <el-breadcrumb-item>用户列表</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 卡片视图 -->
    <el-card>
      <!-- 搜索 添加 -->
      <el-row :gutter="10">
        <el-col :span="8">
          <el-input placeholder="请输入内容" v-model="queryInfo.query" clearable @clear="getUserList">
            <el-button slot="append" icon="el-icon-search" @click="getUserList"></el-button>
          </el-input>
        </el-col>
        <el-col :span="4">
          <el-button type="primary" @click="addDialogVisible = true">添加用户</el-button>
        </el-col>
      </el-row>
      <!--用户列表区域-->
      <el-table :data="userlist" border stripe>
        <el-table-column label="序号" prop="id"></el-table-column>
        <el-table-column label="用户名" prop="username"></el-table-column>
        <el-table-column label="昵称" prop="nickname"></el-table-column>
        <el-table-column label="创建时间" prop="create_time"></el-table-column>
        <el-table-column label="更新时间" prop="update_time"></el-table-column>
      </el-table>
      </el-card>
  </div>
</template>

<script>
import apiAll from "@/common/apiAll"

export default {
  data () {
    return {
      // 获取用户列表的参数对象
      queryInfo:{
        page_no:1,
        page_size:4
      },
      //用户列表
      userlist:[],
      //总行数
      totle:0
    }
  },
  created () {
    this.getUserList()
  },
  methods: {
    getUserList(){
      apiAll.getUser(this.queryInfo).then(res => {
        // console.log(res);
        if (res.status !== 200) {
          return this.$message.error('获取用户列表失败！')
        }
        console.log(res.data.data.list)
        this.userlist = res.data.data.list
        // this.totle = res.data.totle
      })


  }
  }
}
</script>

<style lang="less" scoped>
</style>
